class CallForWorker < ActiveRecord::Base
  has_and_belongs_to_many :events
  belongs_to :user
  has_many :delivery_errors, :dependent => :delete_all
  has_many :delivery_successes, :dependent => :delete_all
  
  def record_delivery_success(user)
    delivery_successes << DeliverySuccess.new(:user => user, :email => user.email)
  end
  
  def record_delivery_error(user, message)
    delivery_errors << DeliveryError.new(:user => user, :email => user.email)
  end
  
end
